*******************************
****** 		SV & CR 		***
****** ISQ replication data ***
****** 		11/02/2020 	*******
******  Stata Version 14.2 ****
*******************************

//Data underlying Figure 1 is based on inactive periods - pie chart

use "Nagel_ISQ2020_Robustness check_victory base.dta", clear

tab reb_PCSV 

graph pie, over(reb_PCSV) pie(1, color(black)) pie(2, color(red))


// To replicate other tables and figures 

use  "Nagel_ISQ2020_Replication.dta", clear 

// continuation vs new practice
* Model 1 - SV + conflict context variables
logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl py py2 py3, cluster(gwnoa)

* Model 2 - SV + country & group context variables
logit recur i.reb_con robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)

* Model 3 - complete model
logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)

eststo: logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl py py2 py3, cluster(gwnoa)
eststo: logit recur i.reb_con robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)
eststo: logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)
esttab using table4.rtf, se

eststo clear

lroc, scheme(s1mono)
estat ic

// Figure 2 
preserve

estsimp logit recur rsv_con rsv_ic rsv_no peace cease lowac lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control, cluster(gwnoa)
setx rsv_con 1 rsv_ic 0 rsv_no 0 peace 0 cease 0 lowac 1 weak 1 political_wing 0 mobcap 0 strong_control 0 res_confl 0 robust_2 0 (lagbest lndur ethnic incompatibility lnpop lnrgdppc v2x_polyarchy ) mean
plotfds, discrete(rsv_con rsv_ic rsv_no peace cease lowac weak ethnic political_wing mobcap robust_2 strong_control res_confl) continuous(lnrgdppc v2x_polyarchy lndur lagbest lnpop) changex(min max) clevel(95) xline(0, lpattern(dash) lcolor(black)) sortorder (rsv_con rsv_ic rsv_no peace cease lowac lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control)
restore

*average likelihood of conflict recurrence*
logit recur rsv_con rsv_ic rsv_no peace cease lowac lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)
mfx 

*Probability of conflict recurrence over time
logit recur c.py##c.py##c.py, cluster(gwnoa)
margins, at(py = (0(1)25))
marginsplot


// Robustness checks
* Model 4a & b - no controls
logit recur i.reb_con, cluster(gwnoa)
logit recur i.reb_con py py2 py3, cluster(gwnoa)

* Model 5 - + women's security, rights, inclusion
logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control rightsmean securitymean inclusionmean py py2 py3, cluster(gwnoa)

* Model 6 - limit peace years to under 15 
logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3 if py < 16, cluster(gwnoa)

* Model 7 - minimum of 5 peace years
logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3 if py > 5, cluster(gwnoa)

* Model 8 - dropping five cases with most inactive years that have featured sexual violence
preserve 
drop if conflictid == 86
drop if conflictid == 146
drop if conflictid == 197
drop if conflictid == 214
drop if conflictid == 222
drop if conflictid == 225

logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)


restore

* Model 9 - dropping conflicts with more than four conflict recurrences
preserve
drop if conflictid == 143
drop if conflictid == 180
drop if conflictid == 192
drop if conflictid == 227 

logit recur i.reb_con i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)


restore


* Model 10 - rebel SV in inactive years * 
logit reb_dum gov_dum lrebsv lgovsv forced peace cease lowac lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3 if active == 0, cluster(gwnoa)

* Model 11 - rebel SV in inactive period coded on last year of available data
logit recur reb_last reb_acsv i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)

* Model 12 - Escalation if looking only at first five post-conflict years *
logit recur reb_dum reb_acsv peace cease lowac lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3 if py > 0, cluster(gwnoa)

* Model 13 - Escalation if looking only at conflicts that terminated decisively (win, peace agreement, ceasefire)
logit recur i.rev_rsv i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3 if outcome < 3, cluster(gwnoa)

* Model 14 - Multiple years of SV in inactive period
logit recur rep_sv i.outcome lagbest lndur ethnic incompatibility res_confl robust_2 lnpop lnrgdppc v2x_polyarchy weak political_wing mobcap strong_control py py2 py3, cluster(gwnoa)
*** rep_sv == 0 perfectly predicts failure and 1599 observations are dropped from analysis 



***** Robustness checks using hazard models *****

use "Nagel_ISQ2020_Robustness check_victory base.dta"

**** SV in inactive period (binary) 
stcox reb_PCSV i.outcome pko incompatibility ethnic_conflict ln_brd ln_gdp_end ln_population_end, nohr cluster(gwnoloc)


**** rebelsv_peacetime (peacetime ordinal) ****
stcox i.rebelsv_peacetime i.outcome pko incompatibility ethnic_conflict ln_brd ln_gdp_end ln_population_end, nohr cluster(gwnoloc)

stcurve, at1(rebelsv_peacetime = 0) at2(rebelsv_peacetime = 1) hazard lpattern(dash solid) lwidth(medthick) lcolor(lavender pink) xtitle("Time")


**** rebelcp (active & inactive period, ordinal) ****
stcox i.rebelcp i.outcome pko incompatibility ethnic_conflict ln_brd ln_gdp_end ln_population_end, nohr cluster(gwnoloc)

stcurve, at1(rebelcp = 0) at2(rebelcp = 1) hazard lpattern(dash solid) lwidth(medthick) lcolor(lavender pink) xtitle("Time")


